import os 
import re
import shutil

fn = '1800075E0'
called_funcs = []
def get_called_func(fn:str, called_funcs:list):
    with open(os.path.abspath(f'{fn}.c'), 'rt') as fp:
        data = ''.join(fp.readlines())
        items = set(re.findall(r'sub_[0-9a-zA-Z]+', data))
        if items:
            called_funcs.extend(items)
            for item in items:
                sfn=item.replace('sub_', '')
                if sfn!=fn:
                    get_called_func(sfn, called_funcs) 

get_called_func(fn, called_funcs)
for f in called_funcs:
    shutil.copy2(f'{f.replace("sub_", "")}.c', 'specified')   
